import { http } from "@/utils/http";
import { baseUrlApi } from "./utils";
import type { aqiFeedbackType, monitorType } from "@/store/types";

export type FeedbackResult = {
  code: number;
  message: string;
  data: {
    list: {
      aqiFeedback: aqiFeedbackType;
      monitor: monitorType;
      imageUrl: string[];
    };
  };
};

/** 获取反馈列表 */
export const getFeedbackListDetail = (data: {
  aqiFeedbackParam: {};
  pageSize: number;
  pageNum: number;
}) => {
  return http.request<FeedbackResult>(
    "post",
    baseUrlApi(
      // "/epms/aqiFeedback/getFeedbackListDetail" +
      "/feedback/getFeedbackListDetail" +
      "?pageSize=" +
      data.pageSize +
      "&pageNum=" +
      data.pageNum
    ),
    {
      data: data.aqiFeedbackParam
    }
  );
};

/** 获取反馈表总页数 */
export const getFeedbackTotalPage = (data: {
  aqiFeedbackParam: {};
  pageSize: number;
}) => {
  return http.request(
    "post",
    baseUrlApi(
      // "/epms/aqiFeedback/getFeedbackListTotalPage" +
      "/feedback/getFeedbackListTotalPage" + "?pageSize=" + data.pageSize
    ),
    {
      data: data.aqiFeedbackParam
    }
  );
};

export const assign = (data: { fbId: number; insId: number }) => {
  console.log(data);
  return http.request(
    "post",
    baseUrlApi(
      // "/epms/aqiFeedback/getFeedbackListTotalPage" +
      "/feedback/assignAqiFeedback?fbId=" + data.fbId + "&insId=" + data.insId
    )
  );
};
